import MusicManager from "../managers/MusicManager";

const { ccclass, property } = cc._decorator;

@ccclass
/**
 * 通用按钮点击音效
 */
export default class ButtonMusic extends cc.Component {
    constructor() {
        super();
    }

    @property({ type: cc.AudioClip, displayName: '点击声音' })
    clickMusic: cc.AudioClip = null;

    start() {
        this.node.on(cc.Node.EventType.TOUCH_START, this.onTouchStart, this);
    }
    onTouchStart() {
        MusicManager.playEffect(this.clickMusic, false);
    }
}